﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Microsoft.Practices.Unity;
using SISLOG.BusinessEntities;
using SISLOG.BusinessLogic;


namespace SISLOG.Web
{
    public partial class frmRegistrarArea : BasePage<frmRegistrarArea> //System.Web.UI.Page
    {
        [Dependency]
        public IAreaBL AreaBL { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
             var acc = Request.QueryString["acc"];

             if (acc != null)
             {
                 if (acc.Equals("nuevo"))
                 {
                     fvRegistrarArea.ChangeMode(FormViewMode.Insert);
                 }
                 else if (acc.Equals("editar"))
                 {
                     fvRegistrarArea.ChangeMode(FormViewMode.Edit);
                 }
             }
        }

        protected void ObjectDataSourceArea_ObjectCreating1(object sender, ObjectDataSourceEventArgs e)
        {
            e.ObjectInstance = AreaBL;
        }

        protected void fvRegistrarArea_ItemInserted(object sender, FormViewInsertedEventArgs e)
        {
            Response.Redirect("frmArea.aspx");
        }

        protected void fvRegistrarArea_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
        {
            Response.Redirect("frmArea.aspx");
        }
    }
}